home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0012_DRIVNAME.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  45 lines

  1. {
  2. BO BendTSEN
  3.  
  4. > There's already a methode For finding all available drives without
  5. > accessing them - I'd like to have one to get the volume Labels of the
  6. > harddisks, SUBST- and network-drives without waiting seconds While the
  7. > Program accesses all the 20 drives available in my system ... ;-)
  8.  
  9. Try this, it will show any SUBST drives, if a \\ first in the name is returned
  10. you will have a network server name following.
  11. }
  12. Uses
  13.   Dos;
  14.  
  15. Function ResolvePath(Var s : String) : Boolean;
  16. Var
  17.   r : Registers;
  18.   x : Byte;
  19. begin
  20.   ResolvePath := False;
  21.   s := s + #0;
  22.   r.ds := Seg(S);
  23.   r.si := Ofs(S) + 1;
  24.   r.es := Seg(S);
  25.   r.di := Ofs(S) + 1;
  26.   r.ah := $60;
  27.   Intr($21, R);
  28.   If r.flags and 1 = 1 Then
  29.     Exit; { if ZF set then error }
  30.   ResolvePath := True;
  31.   x := 0;
  32.   While (s[x + 1] <> #0) And (x < 128) Do
  33.     Inc(x);
  34.   s[0] := Chr(x);
  35. end;
  36.  
  37. Var
  38.   DriveName : String;
  39.  
  40. begin
  41.   DriveName := 'C';
  42.   Writeln(ResolvePath(DriveName));
  43.   Writeln(DriveName);
  44. end.
  45.